define(["./superController", "model/deviceModel", "view/deviceView"], function(SuperController, DeviceModel, DeviceView){
	var DevcieController = function(){}

	Func.extend(DevcieController, SuperController);

	DevcieController.prototype.init = function(){
		this.setModel(new DeviceModel());
		this.setView(new DeviceView());
	}

	DevcieController.prototype.query = function(){
		this.getView().initTable();
	}

	DevcieController.prototype.bindEvent = function(){
		var deviceListDiv = document.getElementById("deviceListDiv");
		Func.bindEvent(deviceListDiv, "click", function(event){
			var target = event.target || event.srcElement;
			console.log("deviceListDiv_click:"+target.id);

			// 设备指令
			switch(target.id){
				case "deviceCmdLocation": 	// 设备定位
					alert("设备定位");
					break;
				case "deviceCmdRrfresh":    //
					alert("设备刷新");
					break;
				case "deviceCmdSendMsg":    //
					alert("发送消息");
					break;
			}

			switch(target.id){
				case "deviceSearchBtn":
					alert("查询设备信息");
					break;
			}

		});

		Func.bindEvent(deviceListDiv, "change", function(event){
			var target = event.target || event.srcElement;
			console.log("deviceListDiv_change:"+target.value);

			switch(target.id){
				case "deviceFilterRelationship":
					alert("归属")
					break;
				case "deviceFilterPlatform":
					alert("平台")
					break;
			}
		});
	}

	return DevcieController;
});